module manager {

    export class RandomManager {

        public static getRand(): number {
            let rand = Math.random() * 99999999;
            rand = parseInt(rand.toString());
            return rand;
        }

        public static getRandRange(min: number, max: number): number {
            let rand = Math.random() * 99999999;
            max = max + 1;
            rand = parseInt(rand.toString());
            rand = rand % (max - min);
            return rand + min;
        }

        public static getRandRangeFloat(min: number, max: number): number {
            let rand = Math.random() * 99999999;
            rand = parseInt(rand.toString());
            rand = rand % (max - min);
            return rand + min;
        }

        public static formatNb(nb: number): string {
            if (nb > 1000) {
                let tailStr = '';
                let tailNb = nb % 1000;
                if (tailNb == 0) {
                    tailStr = "000";
                } else if (tailNb < 10) {
                    tailStr = "00" + tailNb;
                } else if (tailNb < 100) {
                    tailStr = "0" + tailNb;
                } else {
                    tailStr = tailNb + "";
                }
                return parseInt((nb / 1000) + "") + "," + tailStr;
            }
            return nb + "";
        }

    }

}